home *** CD-ROM | disk | FTP | other *** search
/ Language/OS - Multiplatform Resource Library / LANGUAGE OS.iso / oper_sys / emerald / emrldsys.lha / Kernel / DataStructs / sunQueInst.c < prev   
Encoding:
C/C++ Source or Header  |  1990-08-17  |  1.5 KB  |  94 lines

  1. /* File: ~eden/Kernel/DataStructs/sunQueInst.c */
  2.  
  3. /*
  4.  * Queueing routines for Eden Kernel on SUNs.
  5.  * 68010s don't have a set of noninterruptible queue
  6.  * instructions, so we have to fake it by holding
  7.  * signals.
  8.  */
  9.  
  10. /*
  11.  **********************************************************************
  12.  * HISTORY
  13.  *   27-Jun-84 Initial implementation.
  14.  **********************************************************************
  15.  */
  16.  
  17. #include "Kernel/h/stdTypes.h"
  18. #include "Kernel/h/kEvents.h"
  19.  
  20.  
  21.  
  22. void enqueue( fHead, fElt )
  23.     register struct Queue *fHead;
  24.     register struct Queue *fElt;
  25. {
  26.     HoldSigs();
  27.  
  28.     fElt->F = fHead;
  29.     fElt->B = fHead->B;
  30.     fHead->B = fElt;
  31.     (fElt->B)->F = fElt;
  32.  
  33.     ReleaseSigs();
  34. }
  35.  
  36. void remqueue( fHead, fElt )
  37.     register struct Queue *fHead;
  38.     register struct Queue *fElt;
  39. {
  40.     if ( fHead != fElt ) {
  41.  
  42.     HoldSigs();
  43.  
  44.     (fElt->B)->F = fElt->F;
  45.     (fElt->F)->B = fElt->B;
  46.  
  47.     ReleaseSigs();
  48.  
  49.     }
  50. }
  51.  
  52. struct Queue *dequeue( fHead )
  53. register struct Queue *fHead;
  54. {
  55.     register struct Queue *q_tmp;
  56.  
  57.  
  58.     HoldSigs();
  59.  
  60.     q_tmp = fHead->F;
  61.     if (q_tmp == fHead ) {
  62.  
  63.     ReleaseSigs();
  64.  
  65.     return( (struct Queue *) 0 );
  66.     }
  67.     (q_tmp->B)->F = q_tmp->F;
  68.     (q_tmp->F)->B = q_tmp->B;
  69.  
  70.     ReleaseSigs();
  71.  
  72.     return( q_tmp );
  73. }
  74.  
  75. Boolean queueempty( fHead )
  76.     register struct Queue *fHead;
  77. {
  78.     register Boolean b;
  79.  
  80.     HoldSigs();
  81.  
  82.     b = fHead->F == fHead;
  83.  
  84.     ReleaseSigs();
  85.     return( b );
  86. }
  87.  
  88. void initqueue( fHead )
  89.     register struct Queue *fHead;
  90. {
  91.     fHead->F = fHead;
  92.     fHead->B = fHead;
  93. }
  94.